<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.11.
   家居公司留言列表($$)*/

!defined('Q_PATH') && exit;

class Guestbook_C_Controller extends InitController{

	public function index(){
		$arrJiajucompany=$this->_oParent->_arrJiajucompany;
		
		Core_Extend::getSeo($this,array(
			'title'=>"{$arrJiajucompany['jiajucompany_fullname']}网友留言",
			'keywords'=>"{$arrJiajucompany['jiajucompany_fullname']}网友留言",
			'description'=>"{$arrJiajucompany['jiajucompany_fullname']}的网友留言列表",
		));

		// 留言列表
		$arrWhere=array();
		$arrWhere['jiajucompanyguestbook_status']=1;
		$arrWhere['jiajucompany_id']=$arrJiajucompany['jiajucompany_id'];

		$nTotal=Model::F_('jiajucompanyguestbook')->where($arrWhere)->getCounts();
		$oPage=Page::RUN($nTotal,10,Jiaju_Extend::getGuestbookpageUrl($arrJiajucompany,false));
		$arrGuestbooks=Model::F_('jiajucompanyguestbook')
			->setColumns('jiajucompanyguestbook_name,create_dateline,jiajucompanyguestbook_content,jiajucompanyguestbook_replytime,jiajucompanyguestbook_replycontent,jiajucompanyguestbook_replytime')
			->where($arrWhere)
			->order('jiajucompanyguestbook_id DESC')
			->limit($oPage->S(),$oPage->N())
			->getAll();

		$this->assign('arrGuestbooks',$arrGuestbooks);
		$this->assign('nTotalGuestbook',$nTotal);
		$this->assign('sPageNavbar',$oPage->P(array('id'=>'pagination','style'=>'li','current'=>'active')));
		$this->display(Jiaju_Extend::getTemplate($arrJiajucompany));
	}

}
